# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=pinentry
pkgver=1.1.0
pkgrel=2
pkgdesc='A collection of simple PIN or passphrase entry dialogs which utilize the Assuan protocol'
url='https://gnupg.org/related_software/pinentry/'
license=('GPL')
arch=('i686' 'x86_64')
makedepends=('ncurses-devel' 'libassuan-devel' 'libgpg-error-devel')
depends=('ncurses' 'libassuan' 'libgpg-error')
source=(https://gnupg.org/ftp/gcrypt/${pkgname}/${pkgname}-${pkgver}.tar.bz2{,.sig}
        pinentry-0.9.1-msysize.patch
        1.1.0-w32.patch
        1.0.0-libiconv.patch)
sha256sums=('68076686fa724a290ea49cdf0d1c0c1500907d1b759a3bcbfbec0293e8f56570'
            'SKIP'
            '346cf3d9245c87151fd6e3dd88c9f5d4cb47a627cb36cab2d0d993338a0e5a75'
            '0222e625b39f2acd75e718d65ee4eb86f90766cd36e26b9460676766738bc93d'
            '7723a10cfc9f8a711b118ad9bd06e96c2acb9860f91b635b1253588c2a42811c')
validpgpkeys=('D8692123C4065DEA5E0F3AB5249B39D24F25E3B6') # Werner Koch

install=${pkgname}.install

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i ${srcdir}/pinentry-0.9.1-msysize.patch
  patch -p1 -i ${srcdir}/1.1.0-w32.patch
  patch -p2 -i ${srcdir}/1.0.0-libiconv.patch
  ./autogen.sh
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure \
    --build=${CHOST} \
    --prefix=/usr \
    --disable-pinentry-tty \
    --disable-fallback-curses \
    --disable-pinentry-curses \
    --disable-pinentry-gtk2 \
    --disable-pinentry-qt \
    --disable-libsecret \
    --without-libcap

  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make check
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
